import Vue from 'vue'
import Router,{createWebHistory} from 'vue-router'
//managementSystem 配置后管的路由
import website from "./modules/website";
//managementSystem 配置后管的路由
import ManagementSystem from "./modules/managementSystem";
Vue.use(Router)
/* Layout */
export const constantRoutes = [
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },
  {
    path: '/404',
    component: () => import('@/views/error-page/404'),
    hidden: true
  },
  {
    path: '/401',
    component: () => import('@/views/error-page/401'),
    hidden: true
  },
  ...website
]

export const asyncRoutes = [
  ...ManagementSystem,
]

const createRouter = () => new Router({
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRoutes,
  // history: createWebHistory("/"),
  // mode: 'history'
})

const router = createRouter()
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
